<?php
/**
 * translation class
 *
 * @author Sven Ruttloff, www.sruttloff.de <service@sruttloff.de>
 * @copyright S.Ruttloff, Computer Hard- & Software
 * @package core
 * @version 1
 * @license http://www.sruttloff.de/cms/files/licence_en_lgpl.txt LGPL
 */

/**
 * Translate a string
 *
 * @package i18n
 * @version 1
 */
class i18n
{
	/**
	 * @var string actual language
	 */
	private $LANGUAGE = 'de';
	/**
	 * @var array associative language array
	 */
	private $LARRAY = array ();
    /**
     * @var object db object
     */
    private $DB = null;
    /**
     * loads a translation file with language extension e.g. .de
     *
     * @param string target language
     * @return void
     */
    function __construct ($language = null) {
        $this->DB = frontend::getInstance()->getDB();
        return $this->i18nInit($language);
    }

    /**
     * Switch to another language
     *
     * @param string language name
     * @return string language name
     */
    public function SwitchLanguage($language = "") {
        return $this->i18nInit($language);
    }
    /**
     * return a translated string from selected language
     *
     * @param string string to translate
     * @return string
     */
    public function Get($sentence = '') {
        return $sentence;
    }
    /**
     * alias for get
     *
     * @param string string to translate
     * @return string
     */
    public function Translate($sentence = '') {
       return $this->Get($sentence);
    }

	/**
	 * loads a translation file with language extension e.g. .de
	 *
	 * @param string target language
	 * @return void
	 */
	private function i18nInit ($language = null) {
		if ($language)
			$this->LANGUAGE = strtolower($language);
        return;
	}

	/**
	 * if sentence not exists in the transl. table, create this entry in default lang.
	 *
	 * @param string string to translate
	 * @return void
	 */
	private function CreateSentence($sentence = '') {
        return $sentence;
	}
}